{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 千方百计提升手写识别率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "from tensorflow.examples.tutorials.mnist import input_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Extracting MNIST_data\\train-images-idx3-ubyte.gz\n",
      "Extracting MNIST_data\\train-labels-idx1-ubyte.gz\n",
      "Extracting MNIST_data\\t10k-images-idx3-ubyte.gz\n",
      "Extracting MNIST_data\\t10k-labels-idx1-ubyte.gz\n",
      "Iter 0,Testing Accuracy 0.6959,Training Accuracy 0.691436\n",
      "Iter 1,Testing Accuracy 0.782,Training Accuracy 0.777127\n",
      "Iter 2,Testing Accuracy 0.8382,Training Accuracy 0.824127\n",
      "Iter 3,Testing Accuracy 0.8912,Training Accuracy 0.884655\n",
      "Iter 4,Testing Accuracy 0.9035,Training Accuracy 0.899255\n",
      "Iter 5,Testing Accuracy 0.91,Training Accuracy 0.909291\n",
      "Iter 6,Testing Accuracy 0.9155,Training Accuracy 0.914691\n",
      "Iter 7,Testing Accuracy 0.9241,Training Accuracy 0.920745\n",
      "Iter 8,Testing Accuracy 0.9256,Training Accuracy 0.924327\n",
      "Iter 9,Testing Accuracy 0.9264,Training Accuracy 0.928945\n",
      "Iter 10,Testing Accuracy 0.9332,Training Accuracy 0.932891\n",
      "Iter 11,Testing Accuracy 0.9319,Training Accuracy 0.9356\n",
      "Iter 12,Testing Accuracy 0.9344,Training Accuracy 0.938145\n",
      "Iter 13,Testing Accuracy 0.9383,Training Accuracy 0.940764\n",
      "Iter 14,Testing Accuracy 0.9398,Training Accuracy 0.942691\n",
      "Iter 15,Testing Accuracy 0.9417,Training Accuracy 0.9448\n",
      "Iter 16,Testing Accuracy 0.9438,Training Accuracy 0.9468\n",
      "Iter 17,Testing Accuracy 0.9406,Training Accuracy 0.948709\n",
      "Iter 18,Testing Accuracy 0.9435,Training Accuracy 0.950418\n",
      "Iter 19,Testing Accuracy 0.9472,Training Accuracy 0.952255\n",
      "Iter 20,Testing Accuracy 0.9471,Training Accuracy 0.953018\n",
      "Iter 21,Testing Accuracy 0.9471,Training Accuracy 0.954618\n",
      "Iter 22,Testing Accuracy 0.9488,Training Accuracy 0.956127\n",
      "Iter 23,Testing Accuracy 0.9513,Training Accuracy 0.957982\n",
      "Iter 24,Testing Accuracy 0.952,Training Accuracy 0.958109\n",
      "Iter 25,Testing Accuracy 0.9526,Training Accuracy 0.959618\n",
      "Iter 26,Testing Accuracy 0.9518,Training Accuracy 0.960345\n",
      "Iter 27,Testing Accuracy 0.9547,Training Accuracy 0.962236\n",
      "Iter 28,Testing Accuracy 0.9522,Training Accuracy 0.962491\n",
      "Iter 29,Testing Accuracy 0.9527,Training Accuracy 0.964418\n",
      "Iter 30,Testing Accuracy 0.9525,Training Accuracy 0.964236\n",
      "Iter 31,Testing Accuracy 0.9538,Training Accuracy 0.966\n",
      "Iter 32,Testing Accuracy 0.9545,Training Accuracy 0.966636\n",
      "Iter 33,Testing Accuracy 0.957,Training Accuracy 0.966873\n",
      "Iter 34,Testing Accuracy 0.9577,Training Accuracy 0.968964\n",
      "Iter 35,Testing Accuracy 0.9595,Training Accuracy 0.969018\n",
      "Iter 36,Testing Accuracy 0.9592,Training Accuracy 0.969382\n",
      "Iter 37,Testing Accuracy 0.9573,Training Accuracy 0.969909\n",
      "Iter 38,Testing Accuracy 0.96,Training Accuracy 0.971564\n",
      "Iter 39,Testing Accuracy 0.9579,Training Accuracy 0.972164\n",
      "Iter 40,Testing Accuracy 0.9589,Training Accuracy 0.972745\n",
      "Iter 41,Testing Accuracy 0.9601,Training Accuracy 0.9732\n",
      "Iter 42,Testing Accuracy 0.958,Training Accuracy 0.973418\n",
      "Iter 43,Testing Accuracy 0.9625,Training Accuracy 0.973818\n",
      "Iter 44,Testing Accuracy 0.9609,Training Accuracy 0.974836\n",
      "Iter 45,Testing Accuracy 0.959,Training Accuracy 0.975745\n",
      "Iter 46,Testing Accuracy 0.9595,Training Accuracy 0.976309\n",
      "Iter 47,Testing Accuracy 0.9614,Training Accuracy 0.9766\n",
      "Iter 48,Testing Accuracy 0.9599,Training Accuracy 0.977145\n",
      "Iter 49,Testing Accuracy 0.9629,Training Accuracy 0.977473\n",
      "Iter 50,Testing Accuracy 0.9621,Training Accuracy 0.977836\n",
      "Iter 51,Testing Accuracy 0.9634,Training Accuracy 0.978636\n",
      "Iter 52,Testing Accuracy 0.963,Training Accuracy 0.978636\n",
      "Iter 53,Testing Accuracy 0.9633,Training Accuracy 0.979345\n",
      "Iter 54,Testing Accuracy 0.963,Training Accuracy 0.979618\n",
      "Iter 55,Testing Accuracy 0.9618,Training Accuracy 0.979164\n",
      "Iter 56,Testing Accuracy 0.9637,Training Accuracy 0.980564\n",
      "Iter 57,Testing Accuracy 0.9655,Training Accuracy 0.9804\n",
      "Iter 58,Testing Accuracy 0.966,Training Accuracy 0.980945\n",
      "Iter 59,Testing Accuracy 0.9642,Training Accuracy 0.981891\n",
      "Iter 60,Testing Accuracy 0.9651,Training Accuracy 0.9816\n",
      "Iter 61,Testing Accuracy 0.966,Training Accuracy 0.982164\n",
      "Iter 62,Testing Accuracy 0.9639,Training Accuracy 0.982927\n",
      "Iter 63,Testing Accuracy 0.968,Training Accuracy 0.983164\n",
      "Iter 64,Testing Accuracy 0.9663,Training Accuracy 0.983218\n",
      "Iter 65,Testing Accuracy 0.967,Training Accuracy 0.983255\n",
      "Iter 66,Testing Accuracy 0.9646,Training Accuracy 0.983473\n",
      "Iter 67,Testing Accuracy 0.9675,Training Accuracy 0.983691\n",
      "Iter 68,Testing Accuracy 0.9656,Training Accuracy 0.984182\n",
      "Iter 69,Testing Accuracy 0.9665,Training Accuracy 0.984036\n",
      "Iter 70,Testing Accuracy 0.9678,Training Accuracy 0.985036\n",
      "Iter 71,Testing Accuracy 0.9706,Training Accuracy 0.985164\n",
      "Iter 72,Testing Accuracy 0.9673,Training Accuracy 0.985345\n",
      "Iter 73,Testing Accuracy 0.969,Training Accuracy 0.985709\n",
      "Iter 74,Testing Accuracy 0.9684,Training Accuracy 0.985782\n",
      "Iter 75,Testing Accuracy 0.9683,Training Accuracy 0.9864\n",
      "Iter 76,Testing Accuracy 0.9674,Training Accuracy 0.986291\n",
      "Iter 77,Testing Accuracy 0.9669,Training Accuracy 0.986691\n",
      "Iter 78,Testing Accuracy 0.9673,Training Accuracy 0.986491\n",
      "Iter 79,Testing Accuracy 0.9689,Training Accuracy 0.986545\n",
      "Iter 80,Testing Accuracy 0.9682,Training Accuracy 0.987127\n",
      "Iter 81,Testing Accuracy 0.9697,Training Accuracy 0.986909\n",
      "Iter 82,Testing Accuracy 0.9698,Training Accuracy 0.987073\n",
      "Iter 83,Testing Accuracy 0.9682,Training Accuracy 0.987818\n",
      "Iter 84,Testing Accuracy 0.9688,Training Accuracy 0.987782\n",
      "Iter 85,Testing Accuracy 0.9687,Training Accuracy 0.987909\n",
      "Iter 86,Testing Accuracy 0.9689,Training Accuracy 0.988327\n",
      "Iter 87,Testing Accuracy 0.9682,Training Accuracy 0.988545\n",
      "Iter 88,Testing Accuracy 0.9694,Training Accuracy 0.988909\n",
      "Iter 89,Testing Accuracy 0.9704,Training Accuracy 0.988309\n",
      "Iter 90,Testing Accuracy 0.9701,Training Accuracy 0.989636\n",
      "Iter 91,Testing Accuracy 0.9723,Training Accuracy 0.989236\n",
      "Iter 92,Testing Accuracy 0.9707,Training Accuracy 0.989073\n",
      "Iter 93,Testing Accuracy 0.9699,Training Accuracy 0.9896\n",
      "Iter 94,Testing Accuracy 0.9715,Training Accuracy 0.989382\n",
      "Iter 95,Testing Accuracy 0.9694,Training Accuracy 0.989545\n",
      "Iter 96,Testing Accuracy 0.9711,Training Accuracy 0.989945\n",
      "Iter 97,Testing Accuracy 0.9681,Training Accuracy 0.9902\n",
      "Iter 98,Testing Accuracy 0.9725,Training Accuracy 0.989945\n",
      "Iter 99,Testing Accuracy 0.9703,Training Accuracy 0.990236\n",
      "Iter 100,Testing Accuracy 0.9731,Training Accuracy 0.990091\n",
      "Iter 101,Testing Accuracy 0.9718,Training Accuracy 0.990182\n",
      "Iter 102,Testing Accuracy 0.9736,Training Accuracy 0.990727\n",
      "Iter 103,Testing Accuracy 0.9709,Training Accuracy 0.9912\n",
      "Iter 104,Testing Accuracy 0.9711,Training Accuracy 0.991036\n",
      "Iter 105,Testing Accuracy 0.9714,Training Accuracy 0.990673\n",
      "Iter 106,Testing Accuracy 0.9734,Training Accuracy 0.990964\n",
      "Iter 107,Testing Accuracy 0.9712,Training Accuracy 0.991473\n",
      "Iter 108,Testing Accuracy 0.9708,Training Accuracy 0.991418\n",
      "Iter 109,Testing Accuracy 0.9722,Training Accuracy 0.991618\n",
      "Iter 110,Testing Accuracy 0.9722,Training Accuracy 0.991545\n",
      "Iter 111,Testing Accuracy 0.9719,Training Accuracy 0.992018\n",
      "Iter 112,Testing Accuracy 0.9724,Training Accuracy 0.991855\n",
      "Iter 113,Testing Accuracy 0.9714,Training Accuracy 0.991909\n",
      "Iter 114,Testing Accuracy 0.9708,Training Accuracy 0.991873\n",
      "Iter 115,Testing Accuracy 0.9714,Training Accuracy 0.992218\n",
      "Iter 116,Testing Accuracy 0.9741,Training Accuracy 0.9924\n",
      "Iter 117,Testing Accuracy 0.9742,Training Accuracy 0.992382\n",
      "Iter 118,Testing Accuracy 0.9731,Training Accuracy 0.992491\n",
      "Iter 119,Testing Accuracy 0.9731,Training Accuracy 0.992436\n",
      "Iter 120,Testing Accuracy 0.9722,Training Accuracy 0.992691\n",
      "Iter 121,Testing Accuracy 0.972,Training Accuracy 0.992727\n",
      "Iter 122,Testing Accuracy 0.9745,Training Accuracy 0.992964\n",
      "Iter 123,Testing Accuracy 0.9743,Training Accuracy 0.992782\n",
      "Iter 124,Testing Accuracy 0.9716,Training Accuracy 0.993036\n",
      "Iter 125,Testing Accuracy 0.9733,Training Accuracy 0.993164\n",
      "Iter 126,Testing Accuracy 0.9723,Training Accuracy 0.993382\n",
      "Iter 127,Testing Accuracy 0.9725,Training Accuracy 0.993255\n",
      "Iter 128,Testing Accuracy 0.9718,Training Accuracy 0.993164\n",
      "Iter 129,Testing Accuracy 0.9734,Training Accuracy 0.993436\n",
      "Iter 130,Testing Accuracy 0.9736,Training Accuracy 0.9934\n",
      "Iter 131,Testing Accuracy 0.9733,Training Accuracy 0.993509\n",
      "Iter 132,Testing Accuracy 0.972,Training Accuracy 0.993655\n",
      "Iter 133,Testing Accuracy 0.9737,Training Accuracy 0.993691\n",
      "Iter 134,Testing Accuracy 0.9739,Training Accuracy 0.993691\n",
      "Iter 135,Testing Accuracy 0.9741,Training Accuracy 0.993636\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 136,Testing Accuracy 0.9741,Training Accuracy 0.993727\n",
      "Iter 137,Testing Accuracy 0.9735,Training Accuracy 0.994018\n",
      "Iter 138,Testing Accuracy 0.9749,Training Accuracy 0.993873\n",
      "Iter 139,Testing Accuracy 0.9716,Training Accuracy 0.994273\n",
      "Iter 140,Testing Accuracy 0.9738,Training Accuracy 0.9942\n",
      "Iter 141,Testing Accuracy 0.9735,Training Accuracy 0.994255\n",
      "Iter 142,Testing Accuracy 0.9745,Training Accuracy 0.994109\n",
      "Iter 143,Testing Accuracy 0.9757,Training Accuracy 0.994582\n",
      "Iter 144,Testing Accuracy 0.9751,Training Accuracy 0.994291\n",
      "Iter 145,Testing Accuracy 0.9734,Training Accuracy 0.994473\n",
      "Iter 146,Testing Accuracy 0.9745,Training Accuracy 0.994582\n",
      "Iter 147,Testing Accuracy 0.9756,Training Accuracy 0.994709\n",
      "Iter 148,Testing Accuracy 0.9749,Training Accuracy 0.994545\n",
      "Iter 149,Testing Accuracy 0.9748,Training Accuracy 0.994655\n",
      "Iter 150,Testing Accuracy 0.9753,Training Accuracy 0.994927\n",
      "Iter 151,Testing Accuracy 0.976,Training Accuracy 0.994855\n",
      "Iter 152,Testing Accuracy 0.9736,Training Accuracy 0.994909\n",
      "Iter 153,Testing Accuracy 0.9758,Training Accuracy 0.994945\n",
      "Iter 154,Testing Accuracy 0.975,Training Accuracy 0.995164\n",
      "Iter 155,Testing Accuracy 0.9749,Training Accuracy 0.995182\n",
      "Iter 156,Testing Accuracy 0.9741,Training Accuracy 0.995036\n",
      "Iter 157,Testing Accuracy 0.9748,Training Accuracy 0.995018\n",
      "Iter 158,Testing Accuracy 0.9737,Training Accuracy 0.995255\n",
      "Iter 159,Testing Accuracy 0.9744,Training Accuracy 0.995327\n",
      "Iter 160,Testing Accuracy 0.9743,Training Accuracy 0.995073\n",
      "Iter 161,Testing Accuracy 0.9755,Training Accuracy 0.995291\n",
      "Iter 162,Testing Accuracy 0.9749,Training Accuracy 0.995364\n",
      "Iter 163,Testing Accuracy 0.9736,Training Accuracy 0.995327\n",
      "Iter 164,Testing Accuracy 0.9755,Training Accuracy 0.995382\n",
      "Iter 165,Testing Accuracy 0.9751,Training Accuracy 0.995418\n",
      "Iter 166,Testing Accuracy 0.975,Training Accuracy 0.995582\n",
      "Iter 167,Testing Accuracy 0.974,Training Accuracy 0.995855\n",
      "Iter 168,Testing Accuracy 0.9758,Training Accuracy 0.995727\n",
      "Iter 169,Testing Accuracy 0.9756,Training Accuracy 0.995673\n",
      "Iter 170,Testing Accuracy 0.9755,Training Accuracy 0.995691\n",
      "Iter 171,Testing Accuracy 0.975,Training Accuracy 0.995873\n",
      "Iter 172,Testing Accuracy 0.9752,Training Accuracy 0.995782\n",
      "Iter 173,Testing Accuracy 0.9757,Training Accuracy 0.995782\n",
      "Iter 174,Testing Accuracy 0.9746,Training Accuracy 0.996018\n",
      "Iter 175,Testing Accuracy 0.9745,Training Accuracy 0.9962\n",
      "Iter 176,Testing Accuracy 0.9755,Training Accuracy 0.996073\n",
      "Iter 177,Testing Accuracy 0.9749,Training Accuracy 0.995964\n",
      "Iter 178,Testing Accuracy 0.9766,Training Accuracy 0.995964\n",
      "Iter 179,Testing Accuracy 0.9756,Training Accuracy 0.996109\n",
      "Iter 180,Testing Accuracy 0.9754,Training Accuracy 0.996073\n",
      "Iter 181,Testing Accuracy 0.9752,Training Accuracy 0.9962\n",
      "Iter 182,Testing Accuracy 0.975,Training Accuracy 0.996182\n",
      "Iter 183,Testing Accuracy 0.9765,Training Accuracy 0.996109\n",
      "Iter 184,Testing Accuracy 0.9756,Training Accuracy 0.996073\n",
      "Iter 185,Testing Accuracy 0.9775,Training Accuracy 0.996145\n",
      "Iter 186,Testing Accuracy 0.9761,Training Accuracy 0.996491\n",
      "Iter 187,Testing Accuracy 0.9754,Training Accuracy 0.996309\n",
      "Iter 188,Testing Accuracy 0.977,Training Accuracy 0.9964\n",
      "Iter 189,Testing Accuracy 0.9755,Training Accuracy 0.996455\n",
      "Iter 190,Testing Accuracy 0.9765,Training Accuracy 0.996327\n",
      "Iter 191,Testing Accuracy 0.9768,Training Accuracy 0.996491\n",
      "Iter 192,Testing Accuracy 0.975,Training Accuracy 0.996545\n",
      "Iter 193,Testing Accuracy 0.9751,Training Accuracy 0.996509\n",
      "Iter 194,Testing Accuracy 0.976,Training Accuracy 0.996636\n",
      "Iter 195,Testing Accuracy 0.9757,Training Accuracy 0.996527\n",
      "Iter 196,Testing Accuracy 0.9762,Training Accuracy 0.996691\n",
      "Iter 197,Testing Accuracy 0.9756,Training Accuracy 0.9966\n",
      "Iter 198,Testing Accuracy 0.9764,Training Accuracy 0.996582\n",
      "Iter 199,Testing Accuracy 0.9758,Training Accuracy 0.996673\n",
      "Iter 200,Testing Accuracy 0.9772,Training Accuracy 0.996673\n",
      "Iter 201,Testing Accuracy 0.9761,Training Accuracy 0.996709\n",
      "Iter 202,Testing Accuracy 0.9755,Training Accuracy 0.996636\n",
      "Iter 203,Testing Accuracy 0.9768,Training Accuracy 0.996727\n",
      "Iter 204,Testing Accuracy 0.977,Training Accuracy 0.996855\n",
      "Iter 205,Testing Accuracy 0.9782,Training Accuracy 0.996891\n",
      "Iter 206,Testing Accuracy 0.9766,Training Accuracy 0.996891\n",
      "Iter 207,Testing Accuracy 0.9774,Training Accuracy 0.996909\n",
      "Iter 208,Testing Accuracy 0.9786,Training Accuracy 0.996909\n",
      "Iter 209,Testing Accuracy 0.9761,Training Accuracy 0.997\n",
      "Iter 210,Testing Accuracy 0.976,Training Accuracy 0.996964\n",
      "Iter 211,Testing Accuracy 0.9766,Training Accuracy 0.996909\n",
      "Iter 212,Testing Accuracy 0.9757,Training Accuracy 0.997109\n",
      "Iter 213,Testing Accuracy 0.9772,Training Accuracy 0.997\n",
      "Iter 214,Testing Accuracy 0.9771,Training Accuracy 0.997091\n",
      "Iter 215,Testing Accuracy 0.9772,Training Accuracy 0.997145\n",
      "Iter 216,Testing Accuracy 0.9779,Training Accuracy 0.997127\n",
      "Iter 217,Testing Accuracy 0.9774,Training Accuracy 0.997164\n",
      "Iter 218,Testing Accuracy 0.978,Training Accuracy 0.997255\n",
      "Iter 219,Testing Accuracy 0.9771,Training Accuracy 0.997055\n",
      "Iter 220,Testing Accuracy 0.978,Training Accuracy 0.997182\n",
      "Iter 221,Testing Accuracy 0.9766,Training Accuracy 0.997273\n",
      "Iter 222,Testing Accuracy 0.9772,Training Accuracy 0.997218\n",
      "Iter 223,Testing Accuracy 0.9773,Training Accuracy 0.997273\n",
      "Iter 224,Testing Accuracy 0.9759,Training Accuracy 0.997236\n",
      "Iter 225,Testing Accuracy 0.9768,Training Accuracy 0.997273\n",
      "Iter 226,Testing Accuracy 0.9783,Training Accuracy 0.997418\n",
      "Iter 227,Testing Accuracy 0.9775,Training Accuracy 0.997309\n",
      "Iter 228,Testing Accuracy 0.9776,Training Accuracy 0.997345\n",
      "Iter 229,Testing Accuracy 0.9759,Training Accuracy 0.997382\n",
      "Iter 230,Testing Accuracy 0.9758,Training Accuracy 0.9974\n",
      "Iter 231,Testing Accuracy 0.977,Training Accuracy 0.9974\n",
      "Iter 232,Testing Accuracy 0.9759,Training Accuracy 0.997382\n",
      "Iter 233,Testing Accuracy 0.9779,Training Accuracy 0.997364\n",
      "Iter 234,Testing Accuracy 0.977,Training Accuracy 0.997455\n",
      "Iter 235,Testing Accuracy 0.9773,Training Accuracy 0.997491\n",
      "Iter 236,Testing Accuracy 0.9773,Training Accuracy 0.997418\n",
      "Iter 237,Testing Accuracy 0.9776,Training Accuracy 0.997345\n",
      "Iter 238,Testing Accuracy 0.9773,Training Accuracy 0.997491\n",
      "Iter 239,Testing Accuracy 0.9772,Training Accuracy 0.997455\n",
      "Iter 240,Testing Accuracy 0.9784,Training Accuracy 0.997436\n",
      "Iter 241,Testing Accuracy 0.978,Training Accuracy 0.997545\n",
      "Iter 242,Testing Accuracy 0.9761,Training Accuracy 0.997527\n",
      "Iter 243,Testing Accuracy 0.9765,Training Accuracy 0.997491\n",
      "Iter 244,Testing Accuracy 0.9765,Training Accuracy 0.997455\n",
      "Iter 245,Testing Accuracy 0.9767,Training Accuracy 0.997582\n",
      "Iter 246,Testing Accuracy 0.9782,Training Accuracy 0.997545\n",
      "Iter 247,Testing Accuracy 0.9772,Training Accuracy 0.9976\n",
      "Iter 248,Testing Accuracy 0.9766,Training Accuracy 0.997527\n",
      "Iter 249,Testing Accuracy 0.9772,Training Accuracy 0.9976\n",
      "Iter 250,Testing Accuracy 0.9785,Training Accuracy 0.997582\n",
      "Iter 251,Testing Accuracy 0.9773,Training Accuracy 0.997673\n",
      "Iter 252,Testing Accuracy 0.9772,Training Accuracy 0.9976\n",
      "Iter 253,Testing Accuracy 0.9784,Training Accuracy 0.997582\n",
      "Iter 254,Testing Accuracy 0.9767,Training Accuracy 0.997509\n",
      "Iter 255,Testing Accuracy 0.9776,Training Accuracy 0.997709\n",
      "Iter 256,Testing Accuracy 0.9775,Training Accuracy 0.997618\n",
      "Iter 257,Testing Accuracy 0.9762,Training Accuracy 0.9976\n",
      "Iter 258,Testing Accuracy 0.9784,Training Accuracy 0.997673\n",
      "Iter 259,Testing Accuracy 0.9758,Training Accuracy 0.997636\n",
      "Iter 260,Testing Accuracy 0.9757,Training Accuracy 0.997727\n",
      "Iter 261,Testing Accuracy 0.9771,Training Accuracy 0.997582\n",
      "Iter 262,Testing Accuracy 0.9777,Training Accuracy 0.997582\n",
      "Iter 263,Testing Accuracy 0.977,Training Accuracy 0.997727\n",
      "Iter 264,Testing Accuracy 0.9777,Training Accuracy 0.997691\n",
      "Iter 265,Testing Accuracy 0.977,Training Accuracy 0.997836\n",
      "Iter 266,Testing Accuracy 0.9766,Training Accuracy 0.997782\n",
      "Iter 267,Testing Accuracy 0.9783,Training Accuracy 0.997782\n",
      "Iter 268,Testing Accuracy 0.9787,Training Accuracy 0.997691\n",
      "Iter 269,Testing Accuracy 0.9774,Training Accuracy 0.997709\n",
      "Iter 270,Testing Accuracy 0.9784,Training Accuracy 0.997764\n",
      "Iter 271,Testing Accuracy 0.9784,Training Accuracy 0.9978\n",
      "Iter 272,Testing Accuracy 0.9772,Training Accuracy 0.997782\n",
      "Iter 273,Testing Accuracy 0.9777,Training Accuracy 0.997745\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 274,Testing Accuracy 0.9781,Training Accuracy 0.997745\n",
      "Iter 275,Testing Accuracy 0.9782,Training Accuracy 0.9978\n",
      "Iter 276,Testing Accuracy 0.9778,Training Accuracy 0.997818\n",
      "Iter 277,Testing Accuracy 0.9786,Training Accuracy 0.997836\n",
      "Iter 278,Testing Accuracy 0.9771,Training Accuracy 0.997818\n",
      "Iter 279,Testing Accuracy 0.9769,Training Accuracy 0.997927\n",
      "Iter 280,Testing Accuracy 0.9771,Training Accuracy 0.9978\n",
      "Iter 281,Testing Accuracy 0.9764,Training Accuracy 0.997836\n",
      "Iter 282,Testing Accuracy 0.9781,Training Accuracy 0.997891\n",
      "Iter 283,Testing Accuracy 0.9788,Training Accuracy 0.997964\n",
      "Iter 284,Testing Accuracy 0.9774,Training Accuracy 0.997964\n",
      "Iter 285,Testing Accuracy 0.9777,Training Accuracy 0.997891\n",
      "Iter 286,Testing Accuracy 0.9755,Training Accuracy 0.997982\n",
      "Iter 287,Testing Accuracy 0.9792,Training Accuracy 0.997927\n",
      "Iter 288,Testing Accuracy 0.9779,Training Accuracy 0.997945\n",
      "Iter 289,Testing Accuracy 0.9782,Training Accuracy 0.997982\n",
      "Iter 290,Testing Accuracy 0.9779,Training Accuracy 0.997964\n",
      "Iter 291,Testing Accuracy 0.977,Training Accuracy 0.997927\n",
      "Iter 292,Testing Accuracy 0.978,Training Accuracy 0.997964\n",
      "Iter 293,Testing Accuracy 0.9774,Training Accuracy 0.998018\n",
      "Iter 294,Testing Accuracy 0.9786,Training Accuracy 0.997891\n",
      "Iter 295,Testing Accuracy 0.9768,Training Accuracy 0.997927\n",
      "Iter 296,Testing Accuracy 0.9763,Training Accuracy 0.997927\n",
      "Iter 297,Testing Accuracy 0.9786,Training Accuracy 0.997909\n",
      "Iter 298,Testing Accuracy 0.9785,Training Accuracy 0.997982\n",
      "Iter 299,Testing Accuracy 0.9785,Training Accuracy 0.997927\n",
      "Iter 300,Testing Accuracy 0.9785,Training Accuracy 0.997945\n",
      "Iter 301,Testing Accuracy 0.9774,Training Accuracy 0.997982\n",
      "Iter 302,Testing Accuracy 0.978,Training Accuracy 0.997964\n",
      "Iter 303,Testing Accuracy 0.9765,Training Accuracy 0.997927\n",
      "Iter 304,Testing Accuracy 0.978,Training Accuracy 0.997964\n",
      "Iter 305,Testing Accuracy 0.9776,Training Accuracy 0.997964\n",
      "Iter 306,Testing Accuracy 0.9769,Training Accuracy 0.998\n",
      "Iter 307,Testing Accuracy 0.9785,Training Accuracy 0.998055\n",
      "Iter 308,Testing Accuracy 0.9778,Training Accuracy 0.997964\n",
      "Iter 309,Testing Accuracy 0.9791,Training Accuracy 0.998018\n",
      "Iter 310,Testing Accuracy 0.9791,Training Accuracy 0.998036\n",
      "Iter 311,Testing Accuracy 0.9799,Training Accuracy 0.998036\n",
      "Iter 312,Testing Accuracy 0.9778,Training Accuracy 0.998036\n",
      "Iter 313,Testing Accuracy 0.9789,Training Accuracy 0.998\n",
      "Iter 314,Testing Accuracy 0.9797,Training Accuracy 0.997982\n",
      "Iter 315,Testing Accuracy 0.9785,Training Accuracy 0.997964\n",
      "Iter 316,Testing Accuracy 0.9791,Training Accuracy 0.998018\n",
      "Iter 317,Testing Accuracy 0.9772,Training Accuracy 0.998018\n",
      "Iter 318,Testing Accuracy 0.9797,Training Accuracy 0.998091\n",
      "Iter 319,Testing Accuracy 0.9786,Training Accuracy 0.998091\n",
      "Iter 320,Testing Accuracy 0.9786,Training Accuracy 0.998055\n",
      "Iter 321,Testing Accuracy 0.9786,Training Accuracy 0.997982\n",
      "Iter 322,Testing Accuracy 0.9771,Training Accuracy 0.998073\n",
      "Iter 323,Testing Accuracy 0.9788,Training Accuracy 0.998073\n",
      "Iter 324,Testing Accuracy 0.9787,Training Accuracy 0.998073\n",
      "Iter 325,Testing Accuracy 0.9776,Training Accuracy 0.998073\n",
      "Iter 326,Testing Accuracy 0.9782,Training Accuracy 0.998073\n",
      "Iter 327,Testing Accuracy 0.9783,Training Accuracy 0.998164\n",
      "Iter 328,Testing Accuracy 0.9785,Training Accuracy 0.998091\n",
      "Iter 329,Testing Accuracy 0.9779,Training Accuracy 0.998109\n",
      "Iter 330,Testing Accuracy 0.9797,Training Accuracy 0.998164\n",
      "Iter 331,Testing Accuracy 0.9785,Training Accuracy 0.998145\n",
      "Iter 332,Testing Accuracy 0.9796,Training Accuracy 0.998127\n",
      "Iter 333,Testing Accuracy 0.9796,Training Accuracy 0.998145\n",
      "Iter 334,Testing Accuracy 0.9787,Training Accuracy 0.998109\n",
      "Iter 335,Testing Accuracy 0.9764,Training Accuracy 0.998182\n",
      "Iter 336,Testing Accuracy 0.9776,Training Accuracy 0.998182\n",
      "Iter 337,Testing Accuracy 0.9789,Training Accuracy 0.998164\n",
      "Iter 338,Testing Accuracy 0.9784,Training Accuracy 0.998164\n",
      "Iter 339,Testing Accuracy 0.9772,Training Accuracy 0.998236\n",
      "Iter 340,Testing Accuracy 0.9775,Training Accuracy 0.998218\n",
      "Iter 341,Testing Accuracy 0.9789,Training Accuracy 0.998145\n",
      "Iter 342,Testing Accuracy 0.9794,Training Accuracy 0.998218\n",
      "Iter 343,Testing Accuracy 0.9801,Training Accuracy 0.998236\n",
      "Iter 344,Testing Accuracy 0.9785,Training Accuracy 0.9982\n",
      "Iter 345,Testing Accuracy 0.9792,Training Accuracy 0.998182\n",
      "Iter 346,Testing Accuracy 0.9782,Training Accuracy 0.998236\n",
      "Iter 347,Testing Accuracy 0.9787,Training Accuracy 0.998291\n",
      "Iter 348,Testing Accuracy 0.979,Training Accuracy 0.998273\n",
      "Iter 349,Testing Accuracy 0.9797,Training Accuracy 0.998309\n",
      "Iter 350,Testing Accuracy 0.979,Training Accuracy 0.998255\n",
      "Iter 351,Testing Accuracy 0.9784,Training Accuracy 0.998327\n",
      "Iter 352,Testing Accuracy 0.9779,Training Accuracy 0.998327\n",
      "Iter 353,Testing Accuracy 0.9778,Training Accuracy 0.998291\n",
      "Iter 354,Testing Accuracy 0.9781,Training Accuracy 0.998309\n",
      "Iter 355,Testing Accuracy 0.9781,Training Accuracy 0.998273\n",
      "Iter 356,Testing Accuracy 0.9797,Training Accuracy 0.998309\n",
      "Iter 357,Testing Accuracy 0.9787,Training Accuracy 0.998345\n",
      "Iter 358,Testing Accuracy 0.979,Training Accuracy 0.998345\n",
      "Iter 359,Testing Accuracy 0.9792,Training Accuracy 0.998236\n",
      "Iter 360,Testing Accuracy 0.9775,Training Accuracy 0.998327\n",
      "Iter 361,Testing Accuracy 0.9784,Training Accuracy 0.998364\n",
      "Iter 362,Testing Accuracy 0.9788,Training Accuracy 0.998364\n",
      "Iter 363,Testing Accuracy 0.9789,Training Accuracy 0.998345\n",
      "Iter 364,Testing Accuracy 0.979,Training Accuracy 0.998364\n",
      "Iter 365,Testing Accuracy 0.9786,Training Accuracy 0.998327\n",
      "Iter 366,Testing Accuracy 0.9793,Training Accuracy 0.998309\n",
      "Iter 367,Testing Accuracy 0.9784,Training Accuracy 0.998345\n",
      "Iter 368,Testing Accuracy 0.9784,Training Accuracy 0.998345\n",
      "Iter 369,Testing Accuracy 0.979,Training Accuracy 0.998309\n",
      "Iter 370,Testing Accuracy 0.9793,Training Accuracy 0.998364\n",
      "Iter 371,Testing Accuracy 0.9795,Training Accuracy 0.998345\n",
      "Iter 372,Testing Accuracy 0.9794,Training Accuracy 0.998345\n",
      "Iter 373,Testing Accuracy 0.9788,Training Accuracy 0.998291\n",
      "Iter 374,Testing Accuracy 0.9784,Training Accuracy 0.998345\n",
      "Iter 375,Testing Accuracy 0.9794,Training Accuracy 0.998345\n",
      "Iter 376,Testing Accuracy 0.9794,Training Accuracy 0.998382\n",
      "Iter 377,Testing Accuracy 0.9789,Training Accuracy 0.998327\n",
      "Iter 378,Testing Accuracy 0.9794,Training Accuracy 0.998345\n",
      "Iter 379,Testing Accuracy 0.9793,Training Accuracy 0.9984\n",
      "Iter 380,Testing Accuracy 0.9802,Training Accuracy 0.998364\n",
      "Iter 381,Testing Accuracy 0.9788,Training Accuracy 0.998364\n",
      "Iter 382,Testing Accuracy 0.9795,Training Accuracy 0.998364\n",
      "Iter 383,Testing Accuracy 0.9794,Training Accuracy 0.9984\n",
      "Iter 384,Testing Accuracy 0.9795,Training Accuracy 0.9984\n",
      "Iter 385,Testing Accuracy 0.9788,Training Accuracy 0.998364\n",
      "Iter 386,Testing Accuracy 0.9782,Training Accuracy 0.998418\n",
      "Iter 387,Testing Accuracy 0.9793,Training Accuracy 0.998418\n",
      "Iter 388,Testing Accuracy 0.9794,Training Accuracy 0.998418\n",
      "Iter 389,Testing Accuracy 0.9787,Training Accuracy 0.9984\n",
      "Iter 390,Testing Accuracy 0.9779,Training Accuracy 0.998418\n",
      "Iter 391,Testing Accuracy 0.9799,Training Accuracy 0.998364\n",
      "Iter 392,Testing Accuracy 0.9799,Training Accuracy 0.998345\n",
      "Iter 393,Testing Accuracy 0.979,Training Accuracy 0.9984\n",
      "Iter 394,Testing Accuracy 0.9796,Training Accuracy 0.998382\n",
      "Iter 395,Testing Accuracy 0.9785,Training Accuracy 0.998418\n",
      "Iter 396,Testing Accuracy 0.9807,Training Accuracy 0.998436\n",
      "Iter 397,Testing Accuracy 0.9797,Training Accuracy 0.998418\n",
      "Iter 398,Testing Accuracy 0.9795,Training Accuracy 0.998436\n",
      "Iter 399,Testing Accuracy 0.9793,Training Accuracy 0.9984\n",
      "Iter 400,Testing Accuracy 0.9799,Training Accuracy 0.9984\n",
      "Iter 401,Testing Accuracy 0.9791,Training Accuracy 0.998418\n",
      "Iter 402,Testing Accuracy 0.9778,Training Accuracy 0.998436\n",
      "Iter 403,Testing Accuracy 0.9788,Training Accuracy 0.998436\n",
      "Iter 404,Testing Accuracy 0.9801,Training Accuracy 0.9984\n",
      "Iter 405,Testing Accuracy 0.9798,Training Accuracy 0.998418\n",
      "Iter 406,Testing Accuracy 0.9794,Training Accuracy 0.998436\n",
      "Iter 407,Testing Accuracy 0.9788,Training Accuracy 0.998436\n",
      "Iter 408,Testing Accuracy 0.9791,Training Accuracy 0.998418\n",
      "Iter 409,Testing Accuracy 0.9801,Training Accuracy 0.998473\n",
      "Iter 410,Testing Accuracy 0.9784,Training Accuracy 0.998455\n",
      "Iter 411,Testing Accuracy 0.9799,Training Accuracy 0.998436\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 412,Testing Accuracy 0.9801,Training Accuracy 0.998455\n",
      "Iter 413,Testing Accuracy 0.9793,Training Accuracy 0.998455\n",
      "Iter 414,Testing Accuracy 0.9788,Training Accuracy 0.998455\n",
      "Iter 415,Testing Accuracy 0.9793,Training Accuracy 0.998455\n",
      "Iter 416,Testing Accuracy 0.9805,Training Accuracy 0.998455\n",
      "Iter 417,Testing Accuracy 0.9796,Training Accuracy 0.998436\n",
      "Iter 418,Testing Accuracy 0.9792,Training Accuracy 0.998491\n",
      "Iter 419,Testing Accuracy 0.9797,Training Accuracy 0.998473\n",
      "Iter 420,Testing Accuracy 0.9796,Training Accuracy 0.998509\n",
      "Iter 421,Testing Accuracy 0.9798,Training Accuracy 0.998473\n",
      "Iter 422,Testing Accuracy 0.9796,Training Accuracy 0.998455\n",
      "Iter 423,Testing Accuracy 0.9788,Training Accuracy 0.998491\n",
      "Iter 424,Testing Accuracy 0.9806,Training Accuracy 0.998509\n",
      "Iter 425,Testing Accuracy 0.9789,Training Accuracy 0.998473\n",
      "Iter 426,Testing Accuracy 0.979,Training Accuracy 0.998455\n",
      "Iter 427,Testing Accuracy 0.979,Training Accuracy 0.998509\n",
      "Iter 428,Testing Accuracy 0.9786,Training Accuracy 0.998527\n",
      "Iter 429,Testing Accuracy 0.9794,Training Accuracy 0.998473\n",
      "Iter 430,Testing Accuracy 0.9789,Training Accuracy 0.998509\n",
      "Iter 431,Testing Accuracy 0.9816,Training Accuracy 0.998527\n",
      "Iter 432,Testing Accuracy 0.9788,Training Accuracy 0.998545\n",
      "Iter 433,Testing Accuracy 0.9812,Training Accuracy 0.998509\n",
      "Iter 434,Testing Accuracy 0.9805,Training Accuracy 0.998509\n",
      "Iter 435,Testing Accuracy 0.9791,Training Accuracy 0.998527\n",
      "Iter 436,Testing Accuracy 0.9777,Training Accuracy 0.998527\n",
      "Iter 437,Testing Accuracy 0.9797,Training Accuracy 0.998527\n",
      "Iter 438,Testing Accuracy 0.9785,Training Accuracy 0.998509\n",
      "Iter 439,Testing Accuracy 0.9788,Training Accuracy 0.998527\n",
      "Iter 440,Testing Accuracy 0.9794,Training Accuracy 0.998527\n",
      "Iter 441,Testing Accuracy 0.9801,Training Accuracy 0.998509\n",
      "Iter 442,Testing Accuracy 0.9799,Training Accuracy 0.998509\n",
      "Iter 443,Testing Accuracy 0.9795,Training Accuracy 0.998527\n",
      "Iter 444,Testing Accuracy 0.9795,Training Accuracy 0.998473\n",
      "Iter 445,Testing Accuracy 0.9795,Training Accuracy 0.998491\n",
      "Iter 446,Testing Accuracy 0.9787,Training Accuracy 0.998527\n",
      "Iter 447,Testing Accuracy 0.9803,Training Accuracy 0.998545\n",
      "Iter 448,Testing Accuracy 0.9799,Training Accuracy 0.998527\n",
      "Iter 449,Testing Accuracy 0.9802,Training Accuracy 0.998545\n",
      "Iter 450,Testing Accuracy 0.9807,Training Accuracy 0.998545\n",
      "Iter 451,Testing Accuracy 0.98,Training Accuracy 0.998545\n",
      "Iter 452,Testing Accuracy 0.9795,Training Accuracy 0.998545\n",
      "Iter 453,Testing Accuracy 0.9807,Training Accuracy 0.998491\n",
      "Iter 454,Testing Accuracy 0.98,Training Accuracy 0.998564\n",
      "Iter 455,Testing Accuracy 0.9803,Training Accuracy 0.998527\n",
      "Iter 456,Testing Accuracy 0.9815,Training Accuracy 0.998564\n",
      "Iter 457,Testing Accuracy 0.9797,Training Accuracy 0.998564\n",
      "Iter 458,Testing Accuracy 0.9801,Training Accuracy 0.998545\n",
      "Iter 459,Testing Accuracy 0.98,Training Accuracy 0.998509\n",
      "Iter 460,Testing Accuracy 0.9803,Training Accuracy 0.998491\n",
      "Iter 461,Testing Accuracy 0.9803,Training Accuracy 0.998545\n",
      "Iter 462,Testing Accuracy 0.9796,Training Accuracy 0.998545\n",
      "Iter 463,Testing Accuracy 0.9789,Training Accuracy 0.998564\n",
      "Iter 464,Testing Accuracy 0.9807,Training Accuracy 0.998545\n",
      "Iter 465,Testing Accuracy 0.9794,Training Accuracy 0.998545\n",
      "Iter 466,Testing Accuracy 0.9805,Training Accuracy 0.998509\n",
      "Iter 467,Testing Accuracy 0.9797,Training Accuracy 0.998527\n",
      "Iter 468,Testing Accuracy 0.9796,Training Accuracy 0.998564\n",
      "Iter 469,Testing Accuracy 0.9803,Training Accuracy 0.998564\n",
      "Iter 470,Testing Accuracy 0.9791,Training Accuracy 0.998582\n",
      "Iter 471,Testing Accuracy 0.9795,Training Accuracy 0.998564\n",
      "Iter 472,Testing Accuracy 0.981,Training Accuracy 0.998582\n",
      "Iter 473,Testing Accuracy 0.9797,Training Accuracy 0.998582\n",
      "Iter 474,Testing Accuracy 0.9801,Training Accuracy 0.998564\n",
      "Iter 475,Testing Accuracy 0.9812,Training Accuracy 0.998564\n",
      "Iter 476,Testing Accuracy 0.979,Training Accuracy 0.998582\n",
      "Iter 477,Testing Accuracy 0.9794,Training Accuracy 0.998564\n",
      "Iter 478,Testing Accuracy 0.9791,Training Accuracy 0.998545\n",
      "Iter 479,Testing Accuracy 0.9801,Training Accuracy 0.998564\n",
      "Iter 480,Testing Accuracy 0.9803,Training Accuracy 0.998582\n",
      "Iter 481,Testing Accuracy 0.9783,Training Accuracy 0.998545\n",
      "Iter 482,Testing Accuracy 0.9801,Training Accuracy 0.998545\n",
      "Iter 483,Testing Accuracy 0.979,Training Accuracy 0.998582\n",
      "Iter 484,Testing Accuracy 0.9815,Training Accuracy 0.998564\n",
      "Iter 485,Testing Accuracy 0.9797,Training Accuracy 0.998582\n",
      "Iter 486,Testing Accuracy 0.9806,Training Accuracy 0.998582\n",
      "Iter 487,Testing Accuracy 0.9799,Training Accuracy 0.998545\n",
      "Iter 488,Testing Accuracy 0.9802,Training Accuracy 0.998582\n",
      "Iter 489,Testing Accuracy 0.98,Training Accuracy 0.998582\n",
      "Iter 490,Testing Accuracy 0.9787,Training Accuracy 0.998582\n",
      "Iter 491,Testing Accuracy 0.9801,Training Accuracy 0.998564\n",
      "Iter 492,Testing Accuracy 0.9812,Training Accuracy 0.998582\n",
      "Iter 493,Testing Accuracy 0.9804,Training Accuracy 0.998582\n",
      "Iter 494,Testing Accuracy 0.9798,Training Accuracy 0.998564\n",
      "Iter 495,Testing Accuracy 0.9795,Training Accuracy 0.9986\n",
      "Iter 496,Testing Accuracy 0.9798,Training Accuracy 0.998618\n",
      "Iter 497,Testing Accuracy 0.9801,Training Accuracy 0.998618\n",
      "Iter 498,Testing Accuracy 0.9803,Training Accuracy 0.9986\n",
      "Iter 499,Testing Accuracy 0.9802,Training Accuracy 0.998618\n",
      "Iter 500,Testing Accuracy 0.9807,Training Accuracy 0.998618\n",
      "Iter 501,Testing Accuracy 0.9795,Training Accuracy 0.998618\n",
      "Iter 502,Testing Accuracy 0.9795,Training Accuracy 0.998618\n",
      "Iter 503,Testing Accuracy 0.9794,Training Accuracy 0.998618\n",
      "Iter 504,Testing Accuracy 0.9797,Training Accuracy 0.998618\n",
      "Iter 505,Testing Accuracy 0.9789,Training Accuracy 0.9986\n",
      "Iter 506,Testing Accuracy 0.9791,Training Accuracy 0.998636\n",
      "Iter 507,Testing Accuracy 0.9799,Training Accuracy 0.998618\n",
      "Iter 508,Testing Accuracy 0.9789,Training Accuracy 0.998636\n",
      "Iter 509,Testing Accuracy 0.9799,Training Accuracy 0.998636\n",
      "Iter 510,Testing Accuracy 0.9802,Training Accuracy 0.998636\n",
      "Iter 511,Testing Accuracy 0.9797,Training Accuracy 0.998655\n",
      "Iter 512,Testing Accuracy 0.981,Training Accuracy 0.998636\n",
      "Iter 513,Testing Accuracy 0.9806,Training Accuracy 0.998636\n",
      "Iter 514,Testing Accuracy 0.9797,Training Accuracy 0.998636\n",
      "Iter 515,Testing Accuracy 0.9795,Training Accuracy 0.998673\n",
      "Iter 516,Testing Accuracy 0.9796,Training Accuracy 0.998673\n",
      "Iter 517,Testing Accuracy 0.9793,Training Accuracy 0.998655\n",
      "Iter 518,Testing Accuracy 0.9797,Training Accuracy 0.998655\n",
      "Iter 519,Testing Accuracy 0.9781,Training Accuracy 0.998673\n",
      "Iter 520,Testing Accuracy 0.9793,Training Accuracy 0.998655\n",
      "Iter 521,Testing Accuracy 0.9798,Training Accuracy 0.998655\n",
      "Iter 522,Testing Accuracy 0.9794,Training Accuracy 0.998636\n",
      "Iter 523,Testing Accuracy 0.9784,Training Accuracy 0.998673\n",
      "Iter 524,Testing Accuracy 0.9796,Training Accuracy 0.998673\n",
      "Iter 525,Testing Accuracy 0.98,Training Accuracy 0.998655\n",
      "Iter 526,Testing Accuracy 0.9797,Training Accuracy 0.998691\n",
      "Iter 527,Testing Accuracy 0.9798,Training Accuracy 0.998709\n",
      "Iter 528,Testing Accuracy 0.9799,Training Accuracy 0.998709\n",
      "Iter 529,Testing Accuracy 0.9791,Training Accuracy 0.998691\n",
      "Iter 530,Testing Accuracy 0.9793,Training Accuracy 0.998691\n",
      "Iter 531,Testing Accuracy 0.9786,Training Accuracy 0.998709\n",
      "Iter 532,Testing Accuracy 0.9796,Training Accuracy 0.998691\n",
      "Iter 533,Testing Accuracy 0.9809,Training Accuracy 0.998691\n",
      "Iter 534,Testing Accuracy 0.9802,Training Accuracy 0.998636\n",
      "Iter 535,Testing Accuracy 0.9799,Training Accuracy 0.998691\n",
      "Iter 536,Testing Accuracy 0.9795,Training Accuracy 0.998691\n",
      "Iter 537,Testing Accuracy 0.98,Training Accuracy 0.998691\n",
      "Iter 538,Testing Accuracy 0.9804,Training Accuracy 0.998691\n",
      "Iter 539,Testing Accuracy 0.9809,Training Accuracy 0.998709\n",
      "Iter 540,Testing Accuracy 0.9807,Training Accuracy 0.998709\n",
      "Iter 541,Testing Accuracy 0.9807,Training Accuracy 0.998709\n",
      "Iter 542,Testing Accuracy 0.9803,Training Accuracy 0.998691\n",
      "Iter 543,Testing Accuracy 0.9797,Training Accuracy 0.998709\n",
      "Iter 544,Testing Accuracy 0.9802,Training Accuracy 0.998709\n",
      "Iter 545,Testing Accuracy 0.9797,Training Accuracy 0.998691\n",
      "Iter 546,Testing Accuracy 0.9813,Training Accuracy 0.998673\n",
      "Iter 547,Testing Accuracy 0.9792,Training Accuracy 0.998727\n",
      "Iter 548,Testing Accuracy 0.9794,Training Accuracy 0.998673\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 549,Testing Accuracy 0.9796,Training Accuracy 0.998691\n",
      "Iter 550,Testing Accuracy 0.9799,Training Accuracy 0.998709\n",
      "Iter 551,Testing Accuracy 0.9799,Training Accuracy 0.998691\n",
      "Iter 552,Testing Accuracy 0.9781,Training Accuracy 0.998673\n",
      "Iter 553,Testing Accuracy 0.9792,Training Accuracy 0.998709\n",
      "Iter 554,Testing Accuracy 0.9789,Training Accuracy 0.998691\n",
      "Iter 555,Testing Accuracy 0.9809,Training Accuracy 0.998691\n",
      "Iter 556,Testing Accuracy 0.9791,Training Accuracy 0.998691\n",
      "Iter 557,Testing Accuracy 0.9797,Training Accuracy 0.998691\n",
      "Iter 558,Testing Accuracy 0.9803,Training Accuracy 0.998709\n",
      "Iter 559,Testing Accuracy 0.9807,Training Accuracy 0.998691\n",
      "Iter 560,Testing Accuracy 0.9786,Training Accuracy 0.998727\n",
      "Iter 561,Testing Accuracy 0.9809,Training Accuracy 0.998727\n",
      "Iter 562,Testing Accuracy 0.9799,Training Accuracy 0.998727\n",
      "Iter 563,Testing Accuracy 0.9791,Training Accuracy 0.998709\n",
      "Iter 564,Testing Accuracy 0.9801,Training Accuracy 0.998691\n",
      "Iter 565,Testing Accuracy 0.9805,Training Accuracy 0.998727\n",
      "Iter 566,Testing Accuracy 0.9791,Training Accuracy 0.998709\n",
      "Iter 567,Testing Accuracy 0.9797,Training Accuracy 0.998727\n",
      "Iter 568,Testing Accuracy 0.9801,Training Accuracy 0.998727\n",
      "Iter 569,Testing Accuracy 0.9793,Training Accuracy 0.998709\n",
      "Iter 570,Testing Accuracy 0.9809,Training Accuracy 0.998727\n",
      "Iter 571,Testing Accuracy 0.9807,Training Accuracy 0.998709\n",
      "Iter 572,Testing Accuracy 0.9799,Training Accuracy 0.998709\n",
      "Iter 573,Testing Accuracy 0.9797,Training Accuracy 0.998727\n",
      "Iter 574,Testing Accuracy 0.9801,Training Accuracy 0.998727\n",
      "Iter 575,Testing Accuracy 0.9806,Training Accuracy 0.998709\n",
      "Iter 576,Testing Accuracy 0.9804,Training Accuracy 0.998709\n",
      "Iter 577,Testing Accuracy 0.9795,Training Accuracy 0.998727\n",
      "Iter 578,Testing Accuracy 0.9809,Training Accuracy 0.998709\n",
      "Iter 579,Testing Accuracy 0.9797,Training Accuracy 0.998727\n",
      "Iter 580,Testing Accuracy 0.9808,Training Accuracy 0.998727\n",
      "Iter 581,Testing Accuracy 0.9804,Training Accuracy 0.998691\n",
      "Iter 582,Testing Accuracy 0.9794,Training Accuracy 0.998745\n",
      "Iter 583,Testing Accuracy 0.9796,Training Accuracy 0.998745\n",
      "Iter 584,Testing Accuracy 0.9807,Training Accuracy 0.998745\n",
      "Iter 585,Testing Accuracy 0.9804,Training Accuracy 0.998764\n",
      "Iter 586,Testing Accuracy 0.9793,Training Accuracy 0.998782\n",
      "Iter 587,Testing Accuracy 0.9807,Training Accuracy 0.998782\n",
      "Iter 588,Testing Accuracy 0.9806,Training Accuracy 0.998782\n",
      "Iter 589,Testing Accuracy 0.9796,Training Accuracy 0.998745\n",
      "Iter 590,Testing Accuracy 0.9805,Training Accuracy 0.998764\n",
      "Iter 591,Testing Accuracy 0.9813,Training Accuracy 0.998782\n",
      "Iter 592,Testing Accuracy 0.9795,Training Accuracy 0.998764\n",
      "Iter 593,Testing Accuracy 0.9798,Training Accuracy 0.998782\n",
      "Iter 594,Testing Accuracy 0.981,Training Accuracy 0.998782\n",
      "Iter 595,Testing Accuracy 0.98,Training Accuracy 0.998745\n",
      "Iter 596,Testing Accuracy 0.9798,Training Accuracy 0.998782\n",
      "Iter 597,Testing Accuracy 0.9798,Training Accuracy 0.998764\n",
      "Iter 598,Testing Accuracy 0.9798,Training Accuracy 0.998764\n",
      "Iter 599,Testing Accuracy 0.9793,Training Accuracy 0.998782\n",
      "Iter 600,Testing Accuracy 0.9799,Training Accuracy 0.998782\n",
      "Iter 601,Testing Accuracy 0.9806,Training Accuracy 0.998727\n",
      "Iter 602,Testing Accuracy 0.9799,Training Accuracy 0.998782\n",
      "Iter 603,Testing Accuracy 0.9782,Training Accuracy 0.998782\n",
      "Iter 604,Testing Accuracy 0.9809,Training Accuracy 0.998782\n",
      "Iter 605,Testing Accuracy 0.9793,Training Accuracy 0.998782\n",
      "Iter 606,Testing Accuracy 0.9798,Training Accuracy 0.998782\n",
      "Iter 607,Testing Accuracy 0.9809,Training Accuracy 0.998764\n",
      "Iter 608,Testing Accuracy 0.9807,Training Accuracy 0.998782\n",
      "Iter 609,Testing Accuracy 0.9808,Training Accuracy 0.9988\n",
      "Iter 610,Testing Accuracy 0.9807,Training Accuracy 0.9988\n",
      "Iter 611,Testing Accuracy 0.9802,Training Accuracy 0.9988\n",
      "Iter 612,Testing Accuracy 0.9793,Training Accuracy 0.9988\n",
      "Iter 613,Testing Accuracy 0.9791,Training Accuracy 0.998782\n",
      "Iter 614,Testing Accuracy 0.9818,Training Accuracy 0.998782\n",
      "Iter 615,Testing Accuracy 0.9784,Training Accuracy 0.9988\n",
      "Iter 616,Testing Accuracy 0.9811,Training Accuracy 0.9988\n",
      "Iter 617,Testing Accuracy 0.9796,Training Accuracy 0.9988\n",
      "Iter 618,Testing Accuracy 0.9801,Training Accuracy 0.9988\n",
      "Iter 619,Testing Accuracy 0.9802,Training Accuracy 0.9988\n",
      "Iter 620,Testing Accuracy 0.9798,Training Accuracy 0.9988\n",
      "Iter 621,Testing Accuracy 0.98,Training Accuracy 0.9988\n",
      "Iter 622,Testing Accuracy 0.98,Training Accuracy 0.9988\n",
      "Iter 623,Testing Accuracy 0.9797,Training Accuracy 0.9988\n",
      "Iter 624,Testing Accuracy 0.9796,Training Accuracy 0.9988\n",
      "Iter 625,Testing Accuracy 0.9805,Training Accuracy 0.9988\n",
      "Iter 626,Testing Accuracy 0.9804,Training Accuracy 0.9988\n",
      "Iter 627,Testing Accuracy 0.9815,Training Accuracy 0.998782\n",
      "Iter 628,Testing Accuracy 0.9808,Training Accuracy 0.998782\n",
      "Iter 629,Testing Accuracy 0.98,Training Accuracy 0.9988\n",
      "Iter 630,Testing Accuracy 0.9807,Training Accuracy 0.9988\n",
      "Iter 631,Testing Accuracy 0.9806,Training Accuracy 0.9988\n",
      "Iter 632,Testing Accuracy 0.9804,Training Accuracy 0.998782\n",
      "Iter 633,Testing Accuracy 0.9806,Training Accuracy 0.998764\n",
      "Iter 634,Testing Accuracy 0.98,Training Accuracy 0.9988\n",
      "Iter 635,Testing Accuracy 0.981,Training Accuracy 0.9988\n",
      "Iter 636,Testing Accuracy 0.9804,Training Accuracy 0.9988\n",
      "Iter 637,Testing Accuracy 0.9801,Training Accuracy 0.9988\n",
      "Iter 638,Testing Accuracy 0.9803,Training Accuracy 0.9988\n",
      "Iter 639,Testing Accuracy 0.9802,Training Accuracy 0.998782\n",
      "Iter 640,Testing Accuracy 0.9803,Training Accuracy 0.9988\n",
      "Iter 641,Testing Accuracy 0.9802,Training Accuracy 0.9988\n",
      "Iter 642,Testing Accuracy 0.9796,Training Accuracy 0.9988\n",
      "Iter 643,Testing Accuracy 0.9791,Training Accuracy 0.9988\n",
      "Iter 644,Testing Accuracy 0.9793,Training Accuracy 0.998782\n",
      "Iter 645,Testing Accuracy 0.9807,Training Accuracy 0.998818\n",
      "Iter 646,Testing Accuracy 0.9805,Training Accuracy 0.9988\n",
      "Iter 647,Testing Accuracy 0.9816,Training Accuracy 0.998818\n",
      "Iter 648,Testing Accuracy 0.9786,Training Accuracy 0.9988\n",
      "Iter 649,Testing Accuracy 0.9802,Training Accuracy 0.998818\n",
      "Iter 650,Testing Accuracy 0.9818,Training Accuracy 0.998818\n",
      "Iter 651,Testing Accuracy 0.981,Training Accuracy 0.998836\n",
      "Iter 652,Testing Accuracy 0.9796,Training Accuracy 0.9988\n",
      "Iter 653,Testing Accuracy 0.9812,Training Accuracy 0.998836\n",
      "Iter 654,Testing Accuracy 0.9806,Training Accuracy 0.9988\n",
      "Iter 655,Testing Accuracy 0.98,Training Accuracy 0.998836\n",
      "Iter 656,Testing Accuracy 0.9801,Training Accuracy 0.998836\n",
      "Iter 657,Testing Accuracy 0.9801,Training Accuracy 0.998836\n",
      "Iter 658,Testing Accuracy 0.9799,Training Accuracy 0.998818\n",
      "Iter 659,Testing Accuracy 0.9803,Training Accuracy 0.998818\n",
      "Iter 660,Testing Accuracy 0.9795,Training Accuracy 0.998818\n",
      "Iter 661,Testing Accuracy 0.9797,Training Accuracy 0.998818\n",
      "Iter 662,Testing Accuracy 0.9806,Training Accuracy 0.998818\n",
      "Iter 663,Testing Accuracy 0.9822,Training Accuracy 0.998836\n",
      "Iter 664,Testing Accuracy 0.9807,Training Accuracy 0.998818\n",
      "Iter 665,Testing Accuracy 0.9799,Training Accuracy 0.998818\n",
      "Iter 666,Testing Accuracy 0.9818,Training Accuracy 0.998818\n",
      "Iter 667,Testing Accuracy 0.9804,Training Accuracy 0.998836\n",
      "Iter 668,Testing Accuracy 0.9805,Training Accuracy 0.998836\n",
      "Iter 669,Testing Accuracy 0.9803,Training Accuracy 0.998836\n",
      "Iter 670,Testing Accuracy 0.979,Training Accuracy 0.998836\n",
      "Iter 671,Testing Accuracy 0.9799,Training Accuracy 0.998836\n",
      "Iter 672,Testing Accuracy 0.9795,Training Accuracy 0.998836\n",
      "Iter 673,Testing Accuracy 0.9808,Training Accuracy 0.998836\n",
      "Iter 674,Testing Accuracy 0.9799,Training Accuracy 0.998836\n",
      "Iter 675,Testing Accuracy 0.9812,Training Accuracy 0.998836\n",
      "Iter 676,Testing Accuracy 0.981,Training Accuracy 0.998836\n",
      "Iter 677,Testing Accuracy 0.9812,Training Accuracy 0.998818\n",
      "Iter 678,Testing Accuracy 0.9807,Training Accuracy 0.998836\n",
      "Iter 679,Testing Accuracy 0.9813,Training Accuracy 0.998836\n",
      "Iter 680,Testing Accuracy 0.9817,Training Accuracy 0.998836\n",
      "Iter 681,Testing Accuracy 0.9802,Training Accuracy 0.998836\n",
      "Iter 682,Testing Accuracy 0.9808,Training Accuracy 0.998836\n",
      "Iter 683,Testing Accuracy 0.9794,Training Accuracy 0.998818\n",
      "Iter 684,Testing Accuracy 0.9813,Training Accuracy 0.998836\n",
      "Iter 685,Testing Accuracy 0.9809,Training Accuracy 0.998836\n",
      "Iter 686,Testing Accuracy 0.9797,Training Accuracy 0.998836\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 687,Testing Accuracy 0.9811,Training Accuracy 0.998836\n",
      "Iter 688,Testing Accuracy 0.9811,Training Accuracy 0.998836\n",
      "Iter 689,Testing Accuracy 0.9806,Training Accuracy 0.998818\n",
      "Iter 690,Testing Accuracy 0.9811,Training Accuracy 0.998836\n",
      "Iter 691,Testing Accuracy 0.9795,Training Accuracy 0.998836\n",
      "Iter 692,Testing Accuracy 0.979,Training Accuracy 0.998836\n",
      "Iter 693,Testing Accuracy 0.9809,Training Accuracy 0.998836\n",
      "Iter 694,Testing Accuracy 0.9806,Training Accuracy 0.998836\n",
      "Iter 695,Testing Accuracy 0.9804,Training Accuracy 0.998836\n",
      "Iter 696,Testing Accuracy 0.9802,Training Accuracy 0.998836\n",
      "Iter 697,Testing Accuracy 0.9798,Training Accuracy 0.998818\n",
      "Iter 698,Testing Accuracy 0.9801,Training Accuracy 0.998818\n",
      "Iter 699,Testing Accuracy 0.9805,Training Accuracy 0.998836\n",
      "Iter 700,Testing Accuracy 0.9797,Training Accuracy 0.998836\n",
      "Iter 701,Testing Accuracy 0.9825,Training Accuracy 0.998836\n",
      "Iter 702,Testing Accuracy 0.9806,Training Accuracy 0.998836\n",
      "Iter 703,Testing Accuracy 0.9805,Training Accuracy 0.998836\n",
      "Iter 704,Testing Accuracy 0.9808,Training Accuracy 0.998836\n",
      "Iter 705,Testing Accuracy 0.9813,Training Accuracy 0.998836\n",
      "Iter 706,Testing Accuracy 0.9798,Training Accuracy 0.998818\n",
      "Iter 707,Testing Accuracy 0.9808,Training Accuracy 0.998836\n",
      "Iter 708,Testing Accuracy 0.9805,Training Accuracy 0.998818\n",
      "Iter 709,Testing Accuracy 0.9798,Training Accuracy 0.998855\n",
      "Iter 710,Testing Accuracy 0.9805,Training Accuracy 0.998855\n",
      "Iter 711,Testing Accuracy 0.9799,Training Accuracy 0.998855\n",
      "Iter 712,Testing Accuracy 0.9807,Training Accuracy 0.998836\n",
      "Iter 713,Testing Accuracy 0.9804,Training Accuracy 0.998855\n",
      "Iter 714,Testing Accuracy 0.9813,Training Accuracy 0.998873\n",
      "Iter 715,Testing Accuracy 0.9809,Training Accuracy 0.998855\n",
      "Iter 716,Testing Accuracy 0.9818,Training Accuracy 0.998855\n",
      "Iter 717,Testing Accuracy 0.9788,Training Accuracy 0.998873\n",
      "Iter 718,Testing Accuracy 0.9805,Training Accuracy 0.998873\n",
      "Iter 719,Testing Accuracy 0.9806,Training Accuracy 0.998873\n",
      "Iter 720,Testing Accuracy 0.9805,Training Accuracy 0.998873\n",
      "Iter 721,Testing Accuracy 0.9796,Training Accuracy 0.998873\n",
      "Iter 722,Testing Accuracy 0.9807,Training Accuracy 0.998873\n",
      "Iter 723,Testing Accuracy 0.9795,Training Accuracy 0.998873\n",
      "Iter 724,Testing Accuracy 0.9814,Training Accuracy 0.998855\n",
      "Iter 725,Testing Accuracy 0.9815,Training Accuracy 0.998873\n",
      "Iter 726,Testing Accuracy 0.9801,Training Accuracy 0.998873\n",
      "Iter 727,Testing Accuracy 0.9797,Training Accuracy 0.998873\n",
      "Iter 728,Testing Accuracy 0.98,Training Accuracy 0.998855\n",
      "Iter 729,Testing Accuracy 0.9799,Training Accuracy 0.998873\n",
      "Iter 730,Testing Accuracy 0.9809,Training Accuracy 0.998855\n",
      "Iter 731,Testing Accuracy 0.9797,Training Accuracy 0.998873\n",
      "Iter 732,Testing Accuracy 0.9805,Training Accuracy 0.998873\n",
      "Iter 733,Testing Accuracy 0.979,Training Accuracy 0.998873\n",
      "Iter 734,Testing Accuracy 0.9804,Training Accuracy 0.998873\n",
      "Iter 735,Testing Accuracy 0.9813,Training Accuracy 0.998873\n",
      "Iter 736,Testing Accuracy 0.9793,Training Accuracy 0.998873\n",
      "Iter 737,Testing Accuracy 0.9788,Training Accuracy 0.998855\n",
      "Iter 738,Testing Accuracy 0.9795,Training Accuracy 0.998873\n",
      "Iter 739,Testing Accuracy 0.9798,Training Accuracy 0.998873\n",
      "Iter 740,Testing Accuracy 0.9808,Training Accuracy 0.998873\n",
      "Iter 741,Testing Accuracy 0.9814,Training Accuracy 0.998855\n",
      "Iter 742,Testing Accuracy 0.9807,Training Accuracy 0.998873\n",
      "Iter 743,Testing Accuracy 0.9805,Training Accuracy 0.998855\n",
      "Iter 744,Testing Accuracy 0.9802,Training Accuracy 0.998873\n",
      "Iter 745,Testing Accuracy 0.9803,Training Accuracy 0.998873\n",
      "Iter 746,Testing Accuracy 0.9789,Training Accuracy 0.998909\n",
      "Iter 747,Testing Accuracy 0.9796,Training Accuracy 0.998909\n",
      "Iter 748,Testing Accuracy 0.981,Training Accuracy 0.998891\n",
      "Iter 749,Testing Accuracy 0.9808,Training Accuracy 0.998909\n",
      "Iter 750,Testing Accuracy 0.9815,Training Accuracy 0.998909\n",
      "Iter 751,Testing Accuracy 0.9802,Training Accuracy 0.998909\n",
      "Iter 752,Testing Accuracy 0.9815,Training Accuracy 0.998909\n",
      "Iter 753,Testing Accuracy 0.9811,Training Accuracy 0.998891\n",
      "Iter 754,Testing Accuracy 0.9794,Training Accuracy 0.998909\n",
      "Iter 755,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 756,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 757,Testing Accuracy 0.98,Training Accuracy 0.998909\n",
      "Iter 758,Testing Accuracy 0.9802,Training Accuracy 0.998909\n",
      "Iter 759,Testing Accuracy 0.9791,Training Accuracy 0.998909\n",
      "Iter 760,Testing Accuracy 0.9807,Training Accuracy 0.998891\n",
      "Iter 761,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 762,Testing Accuracy 0.981,Training Accuracy 0.998909\n",
      "Iter 763,Testing Accuracy 0.9798,Training Accuracy 0.998909\n",
      "Iter 764,Testing Accuracy 0.9808,Training Accuracy 0.998909\n",
      "Iter 765,Testing Accuracy 0.9799,Training Accuracy 0.998909\n",
      "Iter 766,Testing Accuracy 0.9802,Training Accuracy 0.998909\n",
      "Iter 767,Testing Accuracy 0.9824,Training Accuracy 0.998909\n",
      "Iter 768,Testing Accuracy 0.9799,Training Accuracy 0.998909\n",
      "Iter 769,Testing Accuracy 0.9813,Training Accuracy 0.998891\n",
      "Iter 770,Testing Accuracy 0.9796,Training Accuracy 0.998891\n",
      "Iter 771,Testing Accuracy 0.9818,Training Accuracy 0.998891\n",
      "Iter 772,Testing Accuracy 0.9823,Training Accuracy 0.998909\n",
      "Iter 773,Testing Accuracy 0.9807,Training Accuracy 0.998909\n",
      "Iter 774,Testing Accuracy 0.9799,Training Accuracy 0.998891\n",
      "Iter 775,Testing Accuracy 0.9807,Training Accuracy 0.998891\n",
      "Iter 776,Testing Accuracy 0.9806,Training Accuracy 0.998909\n",
      "Iter 777,Testing Accuracy 0.9801,Training Accuracy 0.998909\n",
      "Iter 778,Testing Accuracy 0.9822,Training Accuracy 0.998909\n",
      "Iter 779,Testing Accuracy 0.9799,Training Accuracy 0.998909\n",
      "Iter 780,Testing Accuracy 0.9809,Training Accuracy 0.998891\n",
      "Iter 781,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 782,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 783,Testing Accuracy 0.98,Training Accuracy 0.998909\n",
      "Iter 784,Testing Accuracy 0.9807,Training Accuracy 0.998909\n",
      "Iter 785,Testing Accuracy 0.98,Training Accuracy 0.998909\n",
      "Iter 786,Testing Accuracy 0.9806,Training Accuracy 0.998909\n",
      "Iter 787,Testing Accuracy 0.9797,Training Accuracy 0.998909\n",
      "Iter 788,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 789,Testing Accuracy 0.9799,Training Accuracy 0.998909\n",
      "Iter 790,Testing Accuracy 0.9814,Training Accuracy 0.998909\n",
      "Iter 791,Testing Accuracy 0.9806,Training Accuracy 0.998909\n",
      "Iter 792,Testing Accuracy 0.9821,Training Accuracy 0.998909\n",
      "Iter 793,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 794,Testing Accuracy 0.981,Training Accuracy 0.998909\n",
      "Iter 795,Testing Accuracy 0.9813,Training Accuracy 0.998909\n",
      "Iter 796,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 797,Testing Accuracy 0.9817,Training Accuracy 0.998909\n",
      "Iter 798,Testing Accuracy 0.9799,Training Accuracy 0.998891\n",
      "Iter 799,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 800,Testing Accuracy 0.9817,Training Accuracy 0.998909\n",
      "Iter 801,Testing Accuracy 0.9802,Training Accuracy 0.998909\n",
      "Iter 802,Testing Accuracy 0.9806,Training Accuracy 0.998909\n",
      "Iter 803,Testing Accuracy 0.9799,Training Accuracy 0.998909\n",
      "Iter 804,Testing Accuracy 0.9804,Training Accuracy 0.998909\n",
      "Iter 805,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 806,Testing Accuracy 0.9804,Training Accuracy 0.998909\n",
      "Iter 807,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 808,Testing Accuracy 0.98,Training Accuracy 0.998909\n",
      "Iter 809,Testing Accuracy 0.9815,Training Accuracy 0.998909\n",
      "Iter 810,Testing Accuracy 0.9808,Training Accuracy 0.998909\n",
      "Iter 811,Testing Accuracy 0.9812,Training Accuracy 0.998909\n",
      "Iter 812,Testing Accuracy 0.9819,Training Accuracy 0.998909\n",
      "Iter 813,Testing Accuracy 0.9815,Training Accuracy 0.998909\n",
      "Iter 814,Testing Accuracy 0.9811,Training Accuracy 0.998909\n",
      "Iter 815,Testing Accuracy 0.981,Training Accuracy 0.998909\n",
      "Iter 816,Testing Accuracy 0.9812,Training Accuracy 0.998909\n",
      "Iter 817,Testing Accuracy 0.98,Training Accuracy 0.998909\n",
      "Iter 818,Testing Accuracy 0.9811,Training Accuracy 0.998891\n",
      "Iter 819,Testing Accuracy 0.981,Training Accuracy 0.998873\n",
      "Iter 820,Testing Accuracy 0.9831,Training Accuracy 0.998909\n",
      "Iter 821,Testing Accuracy 0.9808,Training Accuracy 0.998909\n",
      "Iter 822,Testing Accuracy 0.9796,Training Accuracy 0.998909\n",
      "Iter 823,Testing Accuracy 0.9812,Training Accuracy 0.998909\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 824,Testing Accuracy 0.9814,Training Accuracy 0.998909\n",
      "Iter 825,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 826,Testing Accuracy 0.9814,Training Accuracy 0.998909\n",
      "Iter 827,Testing Accuracy 0.9818,Training Accuracy 0.998909\n",
      "Iter 828,Testing Accuracy 0.9811,Training Accuracy 0.998909\n",
      "Iter 829,Testing Accuracy 0.981,Training Accuracy 0.998909\n",
      "Iter 830,Testing Accuracy 0.9812,Training Accuracy 0.998909\n",
      "Iter 831,Testing Accuracy 0.9809,Training Accuracy 0.998909\n",
      "Iter 832,Testing Accuracy 0.9805,Training Accuracy 0.998909\n",
      "Iter 833,Testing Accuracy 0.9803,Training Accuracy 0.998909\n",
      "Iter 834,Testing Accuracy 0.9791,Training Accuracy 0.998909\n",
      "Iter 835,Testing Accuracy 0.9818,Training Accuracy 0.998909\n",
      "Iter 836,Testing Accuracy 0.9807,Training Accuracy 0.998927\n",
      "Iter 837,Testing Accuracy 0.9801,Training Accuracy 0.998909\n",
      "Iter 838,Testing Accuracy 0.9806,Training Accuracy 0.998927\n",
      "Iter 839,Testing Accuracy 0.9799,Training Accuracy 0.998945\n",
      "Iter 840,Testing Accuracy 0.9815,Training Accuracy 0.998945\n",
      "Iter 841,Testing Accuracy 0.9793,Training Accuracy 0.998945\n",
      "Iter 842,Testing Accuracy 0.9803,Training Accuracy 0.998945\n",
      "Iter 843,Testing Accuracy 0.9798,Training Accuracy 0.998945\n",
      "Iter 844,Testing Accuracy 0.9798,Training Accuracy 0.998945\n",
      "Iter 845,Testing Accuracy 0.9804,Training Accuracy 0.998964\n",
      "Iter 846,Testing Accuracy 0.9807,Training Accuracy 0.998945\n",
      "Iter 847,Testing Accuracy 0.9814,Training Accuracy 0.998927\n",
      "Iter 848,Testing Accuracy 0.9801,Training Accuracy 0.998945\n",
      "Iter 849,Testing Accuracy 0.9814,Training Accuracy 0.998964\n",
      "Iter 850,Testing Accuracy 0.9811,Training Accuracy 0.998964\n",
      "Iter 851,Testing Accuracy 0.982,Training Accuracy 0.998945\n",
      "Iter 852,Testing Accuracy 0.9802,Training Accuracy 0.998927\n",
      "Iter 853,Testing Accuracy 0.9824,Training Accuracy 0.998964\n",
      "Iter 854,Testing Accuracy 0.9806,Training Accuracy 0.998964\n",
      "Iter 855,Testing Accuracy 0.9811,Training Accuracy 0.998964\n",
      "Iter 856,Testing Accuracy 0.9805,Training Accuracy 0.998964\n",
      "Iter 857,Testing Accuracy 0.9812,Training Accuracy 0.998964\n",
      "Iter 858,Testing Accuracy 0.9806,Training Accuracy 0.998964\n",
      "Iter 859,Testing Accuracy 0.9817,Training Accuracy 0.998964\n",
      "Iter 860,Testing Accuracy 0.9819,Training Accuracy 0.998964\n",
      "Iter 861,Testing Accuracy 0.9821,Training Accuracy 0.998964\n",
      "Iter 862,Testing Accuracy 0.9798,Training Accuracy 0.998964\n",
      "Iter 863,Testing Accuracy 0.981,Training Accuracy 0.998964\n",
      "Iter 864,Testing Accuracy 0.981,Training Accuracy 0.998964\n",
      "Iter 865,Testing Accuracy 0.981,Training Accuracy 0.998964\n",
      "Iter 866,Testing Accuracy 0.9794,Training Accuracy 0.998964\n",
      "Iter 867,Testing Accuracy 0.9816,Training Accuracy 0.998964\n",
      "Iter 868,Testing Accuracy 0.9814,Training Accuracy 0.998964\n",
      "Iter 869,Testing Accuracy 0.982,Training Accuracy 0.998982\n",
      "Iter 870,Testing Accuracy 0.9803,Training Accuracy 0.999\n",
      "Iter 871,Testing Accuracy 0.9812,Training Accuracy 0.998964\n",
      "Iter 872,Testing Accuracy 0.9795,Training Accuracy 0.998982\n",
      "Iter 873,Testing Accuracy 0.98,Training Accuracy 0.998982\n",
      "Iter 874,Testing Accuracy 0.9822,Training Accuracy 0.999\n",
      "Iter 875,Testing Accuracy 0.9808,Training Accuracy 0.998982\n",
      "Iter 876,Testing Accuracy 0.9797,Training Accuracy 0.998982\n",
      "Iter 877,Testing Accuracy 0.9814,Training Accuracy 0.998982\n",
      "Iter 878,Testing Accuracy 0.9796,Training Accuracy 0.999\n",
      "Iter 879,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 880,Testing Accuracy 0.9807,Training Accuracy 0.999\n",
      "Iter 881,Testing Accuracy 0.9807,Training Accuracy 0.999\n",
      "Iter 882,Testing Accuracy 0.9807,Training Accuracy 0.999\n",
      "Iter 883,Testing Accuracy 0.9805,Training Accuracy 0.999\n",
      "Iter 884,Testing Accuracy 0.9809,Training Accuracy 0.999\n",
      "Iter 885,Testing Accuracy 0.9803,Training Accuracy 0.998982\n",
      "Iter 886,Testing Accuracy 0.9802,Training Accuracy 0.999\n",
      "Iter 887,Testing Accuracy 0.9811,Training Accuracy 0.998982\n",
      "Iter 888,Testing Accuracy 0.9812,Training Accuracy 0.999\n",
      "Iter 889,Testing Accuracy 0.9804,Training Accuracy 0.998982\n",
      "Iter 890,Testing Accuracy 0.9809,Training Accuracy 0.999\n",
      "Iter 891,Testing Accuracy 0.9813,Training Accuracy 0.999\n",
      "Iter 892,Testing Accuracy 0.9818,Training Accuracy 0.999\n",
      "Iter 893,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 894,Testing Accuracy 0.9807,Training Accuracy 0.999\n",
      "Iter 895,Testing Accuracy 0.981,Training Accuracy 0.999\n",
      "Iter 896,Testing Accuracy 0.9793,Training Accuracy 0.999\n",
      "Iter 897,Testing Accuracy 0.9814,Training Accuracy 0.999\n",
      "Iter 898,Testing Accuracy 0.9821,Training Accuracy 0.999\n",
      "Iter 899,Testing Accuracy 0.9819,Training Accuracy 0.999\n",
      "Iter 900,Testing Accuracy 0.9802,Training Accuracy 0.999\n",
      "Iter 901,Testing Accuracy 0.9808,Training Accuracy 0.998982\n",
      "Iter 902,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 903,Testing Accuracy 0.9806,Training Accuracy 0.999\n",
      "Iter 904,Testing Accuracy 0.979,Training Accuracy 0.999\n",
      "Iter 905,Testing Accuracy 0.9814,Training Accuracy 0.999\n",
      "Iter 906,Testing Accuracy 0.9802,Training Accuracy 0.998982\n",
      "Iter 907,Testing Accuracy 0.9823,Training Accuracy 0.999\n",
      "Iter 908,Testing Accuracy 0.9815,Training Accuracy 0.999\n",
      "Iter 909,Testing Accuracy 0.9803,Training Accuracy 0.998964\n",
      "Iter 910,Testing Accuracy 0.9804,Training Accuracy 0.999\n",
      "Iter 911,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 912,Testing Accuracy 0.982,Training Accuracy 0.998982\n",
      "Iter 913,Testing Accuracy 0.982,Training Accuracy 0.999\n",
      "Iter 914,Testing Accuracy 0.979,Training Accuracy 0.999\n",
      "Iter 915,Testing Accuracy 0.981,Training Accuracy 0.998982\n",
      "Iter 916,Testing Accuracy 0.9807,Training Accuracy 0.998982\n",
      "Iter 917,Testing Accuracy 0.9817,Training Accuracy 0.998982\n",
      "Iter 918,Testing Accuracy 0.9806,Training Accuracy 0.999\n",
      "Iter 919,Testing Accuracy 0.9801,Training Accuracy 0.999\n",
      "Iter 920,Testing Accuracy 0.9814,Training Accuracy 0.999\n",
      "Iter 921,Testing Accuracy 0.982,Training Accuracy 0.998982\n",
      "Iter 922,Testing Accuracy 0.9812,Training Accuracy 0.999\n",
      "Iter 923,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 924,Testing Accuracy 0.9802,Training Accuracy 0.999\n",
      "Iter 925,Testing Accuracy 0.9818,Training Accuracy 0.999\n",
      "Iter 926,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 927,Testing Accuracy 0.9818,Training Accuracy 0.999\n",
      "Iter 928,Testing Accuracy 0.98,Training Accuracy 0.998964\n",
      "Iter 929,Testing Accuracy 0.9818,Training Accuracy 0.999\n",
      "Iter 930,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 931,Testing Accuracy 0.9794,Training Accuracy 0.999\n",
      "Iter 932,Testing Accuracy 0.9814,Training Accuracy 0.999\n",
      "Iter 933,Testing Accuracy 0.9809,Training Accuracy 0.999\n",
      "Iter 934,Testing Accuracy 0.982,Training Accuracy 0.999\n",
      "Iter 935,Testing Accuracy 0.9817,Training Accuracy 0.999\n",
      "Iter 936,Testing Accuracy 0.9809,Training Accuracy 0.999\n",
      "Iter 937,Testing Accuracy 0.9811,Training Accuracy 0.999\n",
      "Iter 938,Testing Accuracy 0.981,Training Accuracy 0.999\n",
      "Iter 939,Testing Accuracy 0.9798,Training Accuracy 0.999\n",
      "Iter 940,Testing Accuracy 0.9798,Training Accuracy 0.999\n",
      "Iter 941,Testing Accuracy 0.9809,Training Accuracy 0.999\n",
      "Iter 942,Testing Accuracy 0.9819,Training Accuracy 0.999\n",
      "Iter 943,Testing Accuracy 0.9795,Training Accuracy 0.998982\n",
      "Iter 944,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 945,Testing Accuracy 0.9803,Training Accuracy 0.999\n",
      "Iter 946,Testing Accuracy 0.982,Training Accuracy 0.999\n",
      "Iter 947,Testing Accuracy 0.9799,Training Accuracy 0.999\n",
      "Iter 948,Testing Accuracy 0.9789,Training Accuracy 0.999\n",
      "Iter 949,Testing Accuracy 0.9813,Training Accuracy 0.999\n",
      "Iter 950,Testing Accuracy 0.9795,Training Accuracy 0.999\n",
      "Iter 951,Testing Accuracy 0.9805,Training Accuracy 0.999\n",
      "Iter 952,Testing Accuracy 0.9812,Training Accuracy 0.998982\n",
      "Iter 953,Testing Accuracy 0.9806,Training Accuracy 0.999\n",
      "Iter 954,Testing Accuracy 0.982,Training Accuracy 0.999\n",
      "Iter 955,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 956,Testing Accuracy 0.9813,Training Accuracy 0.999\n",
      "Iter 957,Testing Accuracy 0.98,Training Accuracy 0.999\n",
      "Iter 958,Testing Accuracy 0.9815,Training Accuracy 0.999\n",
      "Iter 959,Testing Accuracy 0.9818,Training Accuracy 0.999\n",
      "Iter 960,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 961,Testing Accuracy 0.9806,Training Accuracy 0.998982\n",
      "Iter 962,Testing Accuracy 0.9808,Training Accuracy 0.999\n",
      "Iter 963,Testing Accuracy 0.9806,Training Accuracy 0.999\n",
      "Iter 964,Testing Accuracy 0.9808,Training Accuracy 0.999\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iter 965,Testing Accuracy 0.9805,Training Accuracy 0.999018\n",
      "Iter 966,Testing Accuracy 0.9797,Training Accuracy 0.999\n",
      "Iter 967,Testing Accuracy 0.9796,Training Accuracy 0.999018\n",
      "Iter 968,Testing Accuracy 0.98,Training Accuracy 0.998982\n",
      "Iter 969,Testing Accuracy 0.9812,Training Accuracy 0.999\n",
      "Iter 970,Testing Accuracy 0.9818,Training Accuracy 0.999018\n",
      "Iter 971,Testing Accuracy 0.9804,Training Accuracy 0.999018\n",
      "Iter 972,Testing Accuracy 0.9815,Training Accuracy 0.999\n",
      "Iter 973,Testing Accuracy 0.9814,Training Accuracy 0.999\n",
      "Iter 974,Testing Accuracy 0.9821,Training Accuracy 0.999018\n",
      "Iter 975,Testing Accuracy 0.9799,Training Accuracy 0.999018\n",
      "Iter 976,Testing Accuracy 0.9814,Training Accuracy 0.999018\n",
      "Iter 977,Testing Accuracy 0.9814,Training Accuracy 0.999018\n",
      "Iter 978,Testing Accuracy 0.9805,Training Accuracy 0.999018\n",
      "Iter 979,Testing Accuracy 0.9815,Training Accuracy 0.999\n",
      "Iter 980,Testing Accuracy 0.9808,Training Accuracy 0.999018\n",
      "Iter 981,Testing Accuracy 0.9816,Training Accuracy 0.999018\n",
      "Iter 982,Testing Accuracy 0.9814,Training Accuracy 0.999018\n",
      "Iter 983,Testing Accuracy 0.9809,Training Accuracy 0.999018\n",
      "Iter 984,Testing Accuracy 0.9806,Training Accuracy 0.999018\n",
      "Iter 985,Testing Accuracy 0.9806,Training Accuracy 0.999018\n",
      "Iter 986,Testing Accuracy 0.9804,Training Accuracy 0.999018\n",
      "Iter 987,Testing Accuracy 0.9805,Training Accuracy 0.999\n",
      "Iter 988,Testing Accuracy 0.9824,Training Accuracy 0.999\n",
      "Iter 989,Testing Accuracy 0.9801,Training Accuracy 0.999018\n",
      "Iter 990,Testing Accuracy 0.9804,Training Accuracy 0.999036\n",
      "Iter 991,Testing Accuracy 0.9819,Training Accuracy 0.999036\n",
      "Iter 992,Testing Accuracy 0.9799,Training Accuracy 0.999036\n",
      "Iter 993,Testing Accuracy 0.983,Training Accuracy 0.999036\n",
      "Iter 994,Testing Accuracy 0.9805,Training Accuracy 0.999036\n",
      "Iter 995,Testing Accuracy 0.9804,Training Accuracy 0.999036\n",
      "Iter 996,Testing Accuracy 0.9805,Training Accuracy 0.999036\n",
      "Iter 997,Testing Accuracy 0.9807,Training Accuracy 0.999036\n",
      "Iter 998,Testing Accuracy 0.9806,Training Accuracy 0.999036\n",
      "Iter 999,Testing Accuracy 0.9813,Training Accuracy 0.999036\n",
      "completed\n"
     ]
    }
   ],
   "source": [
    "# 载入数据集\n",
    "mnist=input_data.read_data_sets(\"MNIST_data\",one_hot=True)\n",
    "\n",
    "# 每个批次的大小\n",
    "batch_size=200 # 每次放入的数据量\n",
    "# 计算有多少个批次\n",
    "n_batch=mnist.train.num_examples // batch_size\n",
    "\n",
    "# 定义两个placeholder\n",
    "x=tf.placeholder(tf.float32,[None,784])\n",
    "y=tf.placeholder(tf.float32,[None,10])\n",
    "keep_prob=tf.placeholder(tf.float32)\n",
    "\n",
    "# 创建简单的神经网络\n",
    "W1=tf.Variable(tf.truncated_normal([784,2000],stddev=0.1))\n",
    "b1=tf.Variable(tf.zeros([2000])+0.1)\n",
    "L1=tf.nn.tanh(tf.matmul(x,W1)+b1)\n",
    "L1_drop=tf.nn.dropout(L1,keep_prob)\n",
    "\n",
    "W2=tf.Variable(tf.truncated_normal([2000,2000],stddev=0.1))\n",
    "b2=tf.Variable(tf.zeros([2000])+0.1)\n",
    "L2=tf.nn.tanh(tf.matmul(L1_drop,W2)+b2)\n",
    "L2_drop=tf.nn.dropout(L2,keep_prob)\n",
    "\n",
    "W3=tf.Variable(tf.truncated_normal([2000,1000],stddev=0.1))\n",
    "b3=tf.Variable(tf.zeros([1000])+0.1)\n",
    "L3=tf.nn.tanh(tf.matmul(L2_drop,W3)+b3)\n",
    "L3_drop=tf.nn.dropout(L3,keep_prob)\n",
    "\n",
    "W4=tf.Variable(tf.truncated_normal([1000,10],stddev=0.1))\n",
    "b4=tf.Variable(tf.zeros([10])+0.1)\n",
    "prediction=tf.nn.softmax(tf.matmul(L3_drop,W4)+b4)\n",
    "\n",
    "# 二次代价函数\n",
    "# loss=tf.reduce_mean(tf.square(y-prediction))\n",
    "loss=tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=y,logits=prediction))\n",
    "\n",
    "# 使用梯度下降法\n",
    "# train_step=tf.train.GradientDescentOptimizer(0.2).minimize(loss)\n",
    "# 使用Adam\n",
    "train_step=tf.train.AdamOptimizer(1e-5).minimize(loss)\n",
    "\n",
    "# 记过存放在布尔型列表中\n",
    "correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(prediction,1)) # 最大值所在位置\n",
    "# 求准确率\n",
    "accuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))\n",
    "\n",
    "with tf.Session() as sess:\n",
    "    sess.run(tf.global_variables_initializer())\n",
    "    for epoch in range(1000):\n",
    "        for batch in range(n_batch):\n",
    "            batch_xs,batch_ys=mnist.train.next_batch(batch_size)\n",
    "            sess.run(train_step,feed_dict={x:batch_xs,y:batch_ys,keep_prob:0.9})\n",
    "        if(epoch%1==0):\n",
    "            test_acc = sess.run(accuracy,feed_dict={x:mnist.test.images,y:mnist.test.labels,keep_prob:0.9})\n",
    "            train_acc = sess.run(accuracy,feed_dict={x:mnist.train.images,y:mnist.train.labels,keep_prob:0.9})\n",
    "            print(\"Iter \" + str(epoch) + \",Testing Accuracy \" + str(test_acc) +\",Training Accuracy \" + str(train_acc))\n",
    "\n",
    "#         print(\"Iter\"+str(epoch)+\", Testing Accuracy:\"+str(acc))\n",
    "\n",
    "print('completed')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
